import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  server: {
    proxy: {
      '/auth': {
        target: 'http://168.138.163.187/',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/auth/, 'auth') // 不可以省略rewrite
      },
      '/shop': {
        target: 'http://168.138.163.187/',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/shop/, 'shop') // 不可以省略rewrite
      }
    }
  },
  css: {
    preprocessorOptions: {
      scss: {
        additionalData: `@import "./src/styles/variables.scss";` // 引入全局的scss文件
      }
    }
  }
})
